package logic

import (
	"context"
	"house_srv/models"

	"house_srv/house"
	"house_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserShowLogic {
	return &UserShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 用户详情
func (l *UserShowLogic) UserShow(in *house.UserShowRequest) (*house.UserShowResponse, error) {
	// todo: add your logic here and delete this line
	var user models.User
	models.DB.Where("id=?", in.Id).Find(&user)

	return &house.UserShowResponse{
		Phone:    user.Phone,
		Password: user.Password,
		Status:   user.Status,
	}, nil
}
